<template lang="">
    <div>
        名称<van-field v-model='form.name'/>
        选择分类<select v-model='form.cid'>
            <option v-for='i in catelist' :value='i.id'>{{i.name}}</option>
        </select><br>
        <van-button @click='add'>添加</van-button>
        
    </div>
</template>
<script>
export default {
    data(){
        return{
            form:{},
            catelist:[],
        }
    },
    methods: {
        getcatelist(){
            // alert(this.catelist)
            this.$axios.get('cateM').then(res=>{
                this.catelist=res.data.list
               
            })
        },
        add(){
            this.$axios.post('good/goodM',this.form).then(res=>{
                alert('添加成功')
            })
        },
       
    },
    mounted(){
        this.getcatelist()
    }
}
</script>
<style lang="">
    
</style>